package com.my.controller;

import com.my.constant.ControllerConstant;
import com.my.entity.SysMenu;
import com.my.service.SysMenuService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Describe: 邮箱控制器
 * Author: 就 眠 仪 式
 * CreateTime: 2019/10/23
 */
@RestController
@RequestMapping(ControllerConstant.API_SYSTEM_PREFIX + "menu/")
public class SysMenuController {

    @Resource
    private SysMenuService sysMenuService;

    /**
     * Describe: 根据 username 获取菜单数据
     * Param SysRole
     * Return 执行结果
     */
    @GetMapping("/data")
    public List<SysMenu> getUserMenu() {
        List<SysMenu> menus = sysMenuService.getUserMenu("admin");
        return sysMenuService.toUserMenu(menus, "0");
    }
}
